Home

TCP/IP Tutorial

Rich Text Format Help

Creating Graphics for Games

Automatic Menu

Humble CAD Viewer

Demo: Aligning Numbers

Thoughts On Cross-Platform Help

Submission Guildlines

Newsletter Help

Index

Liberty BASIC Runtime Files

The Liberty BASIC library files (SLLs and DLLs) needed when distributing your finalized TKN program are clearly identifed by Liberty BASIC's Help system. To see a list of these library files, activate the Liberty BASIC Help. Then go to Contents, Liberty Basic Help, Using the Runtime Engine. I prefer to include LBASIC30.INI with my setup, especially if my program involves some printing routine.

Although the total size of all these files could exceed 2.5Mb, this is unlikely to present many problems with the advent of modern, multi-gig hard drives and the cheap 700Mb blank CDs now available, even if all these files need to be duplicated for each separate folder containing additional TKN programs.

However for those of us who seldom go online for more than a few minutes, and are still paying by the minute, repeatedly uploading the same files, can involve considerable costs. The simple solution is the place the necessary LB run files in a separate ZIP file, and instruct those interested in downloading TKN programs, to download the ZIP file separately say just once, as I have done on my site.

An AutoMenu to Open TKN Files

Fig 1 - "AutoMenu, with three test applications open"

A further improvement would be to include a Menu TKN file (screenshot shown on the right, source code given below). When this program is placed in a folder containing multiple TKN files, it will automatically generate a menu which provides a button for each TKN file available.

To use this program, do the following:

  1. Use Liberty BASIC to make a tokenized version of the program (*.tkn), and name the tokenized version RUN3.TKN. Place this TKN file in any folder which contains multiple TKN files.

  2. Copy Liberty BASIC's RUN.EXE to the same folder, and rename it RUN3.EXE.

  3. Important: Make sure that all the required Liberty BASIC library files (DLLs and SLLs) reside in the same folder.

  4. Run the executable program RUN3.EXE by double-clicking on it.

Running the program will automatically create a menu similar to the one shown in the screenshot. You will find that this program covers all conditions.

The button menu is based on others I produced many years ago, in the days of when I was only using Qbasic and Quickbasic. It can easily be adapted for menus involving a search for specific files, or your own list of Web Site or Email addresses, and activating any of these. I will produce further articles detailing these if there is a demand.

Gordon Sweet gordon@gsweet.fsnet.co.uk


' Lists/Runs all BAS Files in same directory
' as this menu program, or starts a single TKN.
' Create a RUN3.TKN, rename RUN.EXE as RUN3.EXE
' and activate the RUN3.EXE.

    nomainwin
    dim item$(100) : dim dir$(10,3)
    File$ = Upper$("*.tkn")
    files "", File$, dir$()
    path$ = dir$(0, 2); dir$(0, 3)
    qtyFiles = val(dir$(0, 0))
    none$="NO TKN FILES TO BE RUN !!!"
    if qtyFiles < 2 then notice none$ : end
    if qtyFiles = 2 then [two]    ' ONLY 2 TKN FILES PRESENT
    if qtyFiles > 90 then
        notice "Reduced to the limit of Limit 90!"
        qtyFiles = 90             ' maximum displayable
    end if
    tl$ = "Menu of ";qtyFiles;" TKN files."

    count = qtyFiles             ' CALCULATE HEIGHT OFR MENU
    height = int(count/5) * 30 + 40
    if (int(count/5) <> count/5) then height = height + 30

    ux = 1 : uy = 1
    if DisplayWidth > 1000 then ux = 120 : uy = 90
    UpperLeftX = ux : UpperLeftY = 100 + uy
    WindowWidth = 800 : WindowHeight = height
    open tl$ for graphics_nsb_nf as #1
    #1 "trapclose [quit]; when leftButtonDown [which]; fill cyan"
    #1 "font fixedsys; backcolor darkblue; color yellow; down"

    for x = 1 to qtyFiles
        dir$(x, 1) = right$("        " + dir$(x, 1), 9)
    next x
    for x = qtyFiles to 1 step -1
        ts$ = left$(dir$(x, 0) + "            ", 50)
        ts$ = upper$(trim$(ts$))
        item$(x) = ts$
    next x
    sort item$(), 1, qtyFiles
    gosub [show]

[hold]
    #1 "redraw" : playwave "XXX" ' INSTEAD OF beep
    wait

[show]
    y = 10 : C = 1 : endr = (count+4) / 5
    for row = 1 to endr : x = 4
        for colm = 1 to 5
            #1 "place ";x;" ";y
            #1 "boxfilled ";x+140;" ";y+20
            #1 "place ";x+10;" ";y+14
            #1 p$ : n = C - 1 + colm
            show$ = "\"+item$(n)
            ' SHOW PART OF LONG FILENAMES
            if len(show$)>16 then show$=left$(show$,16)
            #1 show$;
            x=x+160
        next colm
        x = 1 : y = y + 30 : C = C + 5
     next row
     #1 "flush" : return

[which]
    x=MouseX : y=MouseY       ' LEFT CLICK MOUSE POSITION
    if x < 4 or x > 780 then [hold]
    if y < 10 then [hold]
    A = 10 : B = 28 : L = -1
    for D = 1 to 19          ' CHECK MOUSE CURSOR VERTICALLY
        if y > A and y < B then L = D -1
        A = A + 30 : B = B + 30
    next D
    L = L * 5
    A = 5 : B = 142 : K = 0
    for D = 1 to 5           ' CHECK MOUSE CURSOR HORIZONTALLY
        if x > A and x < B then K = D
        A = A + 160 : B = B + 160
    next D
    if D = 0  or L < 0 or K = 0 then [hold] ' NO BUTTON SELECTED
    K = K + L                               ' VALUE OF BUTTON
    if K > count then [hold]                ' NO BUTTON SELECTED
    cf$ = item$(K)                          ' OPTION OF BUTTON
    miss$= cf$+" ALREADY RUNNING!!"
    if cf$="RUN3.TKN" then notice miss$ : goto [hold]
    op$ = "run3.exe "+cf$
    run op$, restore
    goto [hold]

[two]
    ' NO MENU NEEDED - FIND OTHER TKN
    for file = 1 to 2 : file$ = upper$(dir$(file,0))
        if file$ <> "RUN3.TKN" then exit for
    next file
    op$ = "run3.exe " + file$
    run op$, restore
    end

[quit]
    close #1 : end


Home

TCP/IP Tutorial

Rich Text Format Help

Creating Graphics for Games

Automatic Menu

Humble CAD Viewer

Demo: Aligning Numbers

Thoughts On Cross-Platform Help

Submission Guildlines

Newsletter Help

Index